% shift 1D data pointwisely %

function complexData = datashift(originData, numShift, direction)

    len=length(originData);
    shifted_real=zeros([len,1]);
    shifted_imag=zeros([len,1]);

    % shift data %
    if direction == 1   % right shift
        for indx=1:1:len
            if indx+numShift <= len
                
                shifted_real(indx+numShift)=real(originData(indx));
                shifted_imag(indx+numShift)=imag(originData(indx));

            else
                shifted_real(numShift+indx-len)=real(originData(indx));                
                shifted_imag(numShift+indx-len)=imag(originData(indx));
                
            end
        end
    elseif direction == 0   % left shift
        for indx=1:1:len
            if indx-numShift > 0
                
                shifted_real(indx-numShift)=real(originData(indx));
                shifted_imag(indx-numShift)=imag(originData(indx));

            else
                
                shifted_real(len-numShift+indx)=real(originData(indx));                
                shifted_imag(len-numShift+indx)=imag(originData(indx));
                
            end
        end
    else
        fprintf('!!! You can select 0 or 1 for direction, you input %d, \n', direction);
    end

    % complex data %
    complexData=shifted_real+i*shifted_imag;
    
    %% DEBUG %%
    
        
end% the last line %